package org.wlc;


import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.wlc.service.TypeService;
import org.wlc.service.UserService;
import org.wlc.service.UserService3;

/**
 * Hello world!
 */
public class App {
    private static ApplicationContext context ;

    public static void main(String[] args) {
        method05();
    }

    public static void method05(){
        context = new ClassPathXmlApplicationContext("Spring5.xml");
        UserService userService = (UserService) context.getBean("userService");
        userService.test();
    }

    /**
     * 手动注入： 实例化工厂注入
     */
    public static void method04(){
        context = new ClassPathXmlApplicationContext("Spring4.xml");
        TypeService typeService = (TypeService) context.getBean("typeService");
        typeService.test();
    }

    /**
     * 手动注入： 静态工厂注入
     */
    public static void method03(){
        context = new ClassPathXmlApplicationContext("Spring3.xml");
        TypeService typeService = (TypeService) context.getBean("typeService");
        typeService.test();
    }
    /**
     * 手动注入： set方式注入
     */
    public static void method02(){
        context = new ClassPathXmlApplicationContext("Spring2.xml");
        UserService userService = (UserService) context.getBean("userService");
        userService.test();
    }
    /**
     *
     * 手动注入： 构造器注入方式注入
     */
    public static void method01(){
        context = new ClassPathXmlApplicationContext("Spring.xml");
        UserService3 userService3 = (UserService3) context.getBean("userService3");
        userService3.test();

    }
}
